package com.note.web;

import com.note.common.annotation.Log;
import com.note.common.core.controller.BaseController;
import com.note.common.core.domain.AjaxResult;
import com.note.common.core.page.TableDataInfo;
import com.note.common.enums.BusinessType;
import com.note.common.utils.poi.ExcelUtil;
import com.note.domain.SysUserNoted;
import com.note.service.ISysUserNotedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.io.File;
import java.util.List;

/**
 * 【请填写功能名称】Controller
 * 
 * @author ruoyi
 * @date 2021-01-07
 */
@RestController
@RequestMapping("/system/noted")
public class SysUserNotedController extends BaseController
{
    @Autowired
    private ISysUserNotedService sysUserNotedService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:noted:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysUserNoted sysUserNoted)
    {
        startPage();
        List<SysUserNoted> list = sysUserNotedService.selectSysUserNotedList(sysUserNoted);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:noted:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SysUserNoted sysUserNoted)
    {
        List<SysUserNoted> list = sysUserNotedService.selectSysUserNotedList(sysUserNoted);
        ExcelUtil<SysUserNoted> util = new ExcelUtil<SysUserNoted>(SysUserNoted.class);
        return util.exportExcel(list, "noted");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:noted:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(sysUserNotedService.selectSysUserNotedById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:noted:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysUserNoted sysUserNoted)
    {
        return toAjax(sysUserNotedService.insertSysUserNoted(sysUserNoted));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:noted:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysUserNoted sysUserNoted)
    {
        return toAjax(sysUserNotedService.updateSysUserNoted(sysUserNoted));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:noted:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysUserNotedService.deleteSysUserNotedByIds(ids));
    }



}
